﻿using System.Collections.Generic;
using System.Web.Mvc;
using Presentation.Web.Core.Utility;

namespace Presentation.Web.UI.Helpers
{

    public static class ModelStateHelpers {

        public static void AddModelErrors(this ModelStateDictionary modelState, IEnumerable<RuleViolation> errors) {

            foreach (RuleViolation issue in errors) {
                modelState.AddModelError(issue.PropertyName, issue.ErrorMessage);
            }
        }
    }
}
